<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改工资详情')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-wage-edit" th:object="${recordWage}">
            <input name="wageId" th:field="*{wageId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">员工：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="userId" type="hidden" th:field="*{userId}"  />
                        <input class="form-control" type="text" onclick="selectUserTree()" id="treeName" readonly="true" th:field="*{userName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">工资类别：</label>
                <div class="col-sm-8">
                    <select name="salaryType" id="salaryType" class="form-control m-b">
                        <option value="1" th:selected="*{salaryType == '1'}">在职职工</option>
                        <option value="2" th:selected="*{salaryType == '2'}">退休职工</option>
                        <option value="3" th:selected="*{salaryType == '3'}">铁路退休职工</option>
                        <option value="4" th:selected="*{salaryType == '4'}">临时工</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">聘任岗位级别：</label>
                <div class="col-sm-8">
                    <select name="appointLevel" class="form-control m-b" th:with="type=${@dict.getType('appoint_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{appointLevel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">工资薪级：</label>
                <div class="col-sm-8">
                    <select name="salaryLevel" class="form-control m-b" th:with="type=${@dict.getType('salary_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salaryLevel}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">岗位工资：</label>
                <div class="col-sm-8">
                    <input name="a0" class="form-control" th:field="*{a0}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">薪级工资：</label>
                <div class="col-sm-8">
                    <input name="a1" class="form-control" th:field="*{a1}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">教护工资：</label>
                <div class="col-sm-8">
                    <input name="a2" class="form-control" th:field="*{a2}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">基础绩效：</label>
                <div class="col-sm-8">
                    <input name="a3" class="form-control" th:field="*{a3}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">基础绩效奖：</label>
                <div class="col-sm-8">
                    <input name="a4" class="form-control" th:field="*{a4}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">物业：</label>
                <div class="col-sm-8">
                    <input name="a5" class="form-control" th:field="*{a5}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">房贴：</label>
                <div class="col-sm-8">
                    <input name="a6" class="form-control" th:field="*{a6}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">奖励性绩效：</label>
                <div class="col-sm-8">
                    <input name="a7" class="form-control" th:field="*{a7}" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">执行时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="wageTime" th:value="${#dates.format(recordWage.wageTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">是否默认：</label>
                <div class="col-sm-8">
                    <select name="isDefault" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isDefault}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "record/wage";
        $("#form-wage-edit").validate({
            focusCleanup: true
        });

        /* 选择人员 */
        function selectUserTree() {
            var options = {
                title: '选择员工',
                width: "380",
                url: ctx + "basic/user/selectTree",
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
            var treeType = body.find('#treeType').val();
            if(treeType == 'user'){
                var id = body.find('#treeId').val();
                var treeId = id.substring(id.indexOf('_') + 1, id.length);
                $("#treeId").val(treeId);
                $("#treeName").val(body.find('#treeName').val());
                layer.close(index);
            }else{
                $.modal.alertError("请选择员工");
            }
        }

        function submitHandler() {
            if ($.validate.form()) {
                var treeId = $("#treeId").val();
                if(treeId == '') {
                    $.modal.msgError('请先选择员工');
                    return;
                }
                $.operate.save(prefix + "/edit", $('#form-wage-edit').serialize());
            }
        }

        $("input[name='wageTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>